main:
	mvn compile war:inplace

install: main
	@echo "Starting install..."
	@sudo rsync -av --delete src/main/webapp/ /opt/tomcat/webapps/gnizr-feed/ > /dev/null 2>&1
	@echo "Install Complete! Please reload tomcat to see changes reflected."

spinstall: sp
	@echo "Starting stored procedure install..."
	mysql -u gnizr --password=gnizr gnizr < sp-gnizrfeed.sql
	@echo "Stored procedures loaded successfully!"

eclipse:
	mvn eclipse:eclipse

sp:
	@echo "Compiling stored procedures..."
	@echo "delimiter //" > sp-gnizrfeed.sql
	@find sql/ -name "*.sql" -exec cat {} >> sp-gnizrfeed.sql \;
	@echo "sp-gnizrfeed.sql generated successfully!"

clean:
	mvn clean
	rm -rf src/main/webapp
	rm -rf target
	rm -f sp-gnizrfeed.sql

cleanest: clean
	mvn eclipse:clean
